﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ElingOA6_DSJCJ.BLL
{
    /// <summary>
    /// 友情连接明细 逻辑类
    /// </summary>
    public class LinkTypeEntry
    {
        /// <summary>
        ///  友情链接明细数据类
        /// </summary>
        private DAL.LinkTypeEntry linkTypeEntryDAL = new DAL.LinkTypeEntry();
        /// <summary>
        /// 构造函数
        /// </summary>
        public LinkTypeEntry()
        {
        }
        /// <summary>
        /// 获得数据列表
        /// <creator>wangl</creator>
        /// <date>2013-09-09</date>
        /// </summary>
        public List<Model.LinkTypeEntry> GetListByLinkType(string entityNo, string linkTypeCD)
        {
            DataSet ds = linkTypeEntryDAL.GetListByLinkType(entityNo,linkTypeCD);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        private List<Model.LinkTypeEntry> DataTableToList(DataTable dt)
        {
            List<Model.LinkTypeEntry> modelList = new List<Model.LinkTypeEntry>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Model.LinkTypeEntry model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = linkTypeEntryDAL.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }

    }
}
